package com.wyt.controller.purchaseController;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wyt.dao.HistoryOrderMapper1;

import com.wyt.entity.Purchase;
import com.wyt.entity.Purchase1;
import com.wyt.until.TableLayui;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("history")
public class HistoryController {
    @Autowired
    private HistoryOrderMapper1 historyOrderMapper;

    @RequestMapping("selectAllHistory")
    public TableLayui selectAllHistory(Integer page, Integer limit, String ename, String beginTime, String endTime){
        PageHelper.startPage(page,limit);
        List<Purchase1> purchases = historyOrderMapper.selectAllHistory(ename,beginTime,endTime);
        PageInfo<Purchase1> pageInfo = new PageInfo<>(purchases);
        return new TableLayui(0,"",pageInfo.getTotal(),pageInfo.getList());
    }

}
